package com.niit.search.mapper;

import com.niit.search.entity.Activity;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Param;
import java.util.List;

@Mapper
public interface ActivityMapper {
    @Select("SELECT * FROM tb_activity WHERE content LIKE CONCAT('%', #{keyword}, '%')")
    List<Activity> searchActivityByKeyword(@Param("keyword") String keyword);
    
    /**
     * 根据话题ID查询相关动态
     * @param topicId 话题ID
     * @return 相关动态列表
     */
    @Select("SELECT * FROM tb_activity WHERE topic_id = #{topicId} AND is_deleted = 0 ORDER BY create_date DESC")
    List<Activity> findActivitiesByTopicId(@Param("topicId") Long topicId);
}